import { Node } from 'cc';

export class GridManager {
    private grid: Node[][] = [];
    private width: number;
    private height: number;

    constructor(width: number, height: number) {
        this.width = width;
        this.height = height;
        this.grid = new Array(width).fill(null).map(() => new Array(height).fill(null));
    }

    // 设置方块
    setBlock(x: number, y: number, block: Node) {
        this.grid[x][y] = block;
    }

    // 获取方块
    getBlock(x: number, y: number): Node {
        return this.grid[x][y];
    }

    public getWidth(): number {
        return this.width;
    }

    public getHeight(): number {
        return this.height;
    }
} 